]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Use g_set_str where possible
authorBilal Elmoussaoui <belmouss@redhat.com>
Wed, 8 Apr 2026 12:00:03 +0000 (14:00 +0200)
committerBilal Elmoussaoui <belmouss@redhat.com>
Wed, 8 Apr 2026 12:00:03 +0000 (14:00 +0200)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4162>

src/shell-app.c
src/st/st-widget.c

index 84b75beb9c362923cb7d789d9ed9d78de7cdc9b7..8a90f438494137f28430687742cbb09c35f776e8 100644 (file)
@@ -1324,7 +1324,7 @@ apply_discrete_gpu_env (GAppLaunchContext *context,
     }
 
   GVariant *gpu_list[] = { first_nondefault_discrete, first_discrete, first_nondefault };
-  
+
   for (i = 0; i < G_N_ELEMENTS (gpu_list); ++i)
     {
       GVariant *gpu = gpu_list[i];
@@ -1701,8 +1701,7 @@ shell_app_update_app_actions (ShellApp   *app,
       if (application_object_path == NULL || unique_bus_name == NULL)
         return;
 
-      g_clear_pointer (&app->running_state->unique_bus_name, g_free);
-      app->running_state->unique_bus_name = g_strdup (unique_bus_name);
+      g_set_str (&app->running_state->unique_bus_name, unique_bus_name);
       actions = g_dbus_action_group_get (app->running_state->session, unique_bus_name, application_object_path);
       gtk_action_muxer_insert (app->running_state->muxer, "app", G_ACTION_GROUP (actions));
       g_object_unref (actions);
index 983263f0ef3873ebdb48a228b5b232c183d08a86..ea19043f502ef3a3aca591fedfe8b63576c2f00a 100644 (file)
@@ -1046,20 +1046,6 @@ find_class_name (const gchar *class_list,
   return NULL;
 }
 
-static gboolean
-set_class_list (gchar       **class_list,
-                const gchar  *new_class_list)
-{
-  if (g_strcmp0 (*class_list, new_class_list) != 0)
-    {
-      g_free (*class_list);
-      *class_list = g_strdup (new_class_list);
-      return TRUE;
-    }
-  else
-    return FALSE;
-}
-
 static gboolean
 add_class_name (gchar       **class_list,
                 const gchar  *class_name)
@@ -1139,7 +1125,7 @@ st_widget_set_style_class_name (StWidget    *actor,
 
   priv = st_widget_get_instance_private (actor);
 
-  if (set_class_list (&priv->style_class, style_class_list))
+  if (g_set_str (&priv->style_class, style_class_list))
     {
       st_widget_style_changed (actor);
       g_object_notify_by_pspec (G_OBJECT (actor), props[PROP_STYLE_CLASS]);
@@ -1308,7 +1294,7 @@ st_widget_set_style_pseudo_class (StWidget    *actor,
 
   priv = st_widget_get_instance_private (actor);
 
-  if (set_class_list (&priv->pseudo_class, pseudo_class_list))
+  if (g_set_str (&priv->pseudo_class, pseudo_class_list))
     {
       st_widget_style_changed (actor);
       g_object_notify_by_pspec (G_OBJECT (actor), props[PROP_PSEUDO_CLASS]);
@@ -1390,11 +1376,8 @@ st_widget_set_style (StWidget  *actor,
 
   priv = st_widget_get_instance_private (actor);
 
-  if (g_strcmp0 (style, priv->inline_style))
+  if (g_set_str (&priv->inline_style, style))
     {
-      g_free (priv->inline_style);
-      priv->inline_style = g_strdup (style);
-
       st_widget_style_changed (actor);
 
       g_object_notify_by_pspec (G_OBJECT (actor), props[PROP_STYLE]);